package FileReader;


import javax.swing.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileReader {
    public static void main(String[] args) {
        byte []b=new byte[30];
        FileInputStream inputStream= null;
        try {
            inputStream = new FileInputStream("FileReader.java");
            ProgressMonitorInputStream in =new ProgressMonitorInputStream(null,"读取文件进度",inputStream);
            ProgressMonitor p=in.getProgressMonitor();
            while (in.read(b)!=-1){
                String s=new String(b);
                System.out.println(s);
                Thread.sleep(1000);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
